extends Camera2D

func shake_camera():
	var time = 0#时间
	var length = 6#长度
	var time_add = 1#时间累加值
	var shake_range = 5#抖动范围
	var freq = 0.01#抖动频率
	var cameraPos = position
	while time < length:
		time+=time_add
		var offset = Vector2()
		#offset.x = randf_range(-2,2)
		offset.y = randf_range(-shake_range,shake_range)
		var newPos = position
		newPos += offset
		position=newPos
		await get_tree().create_timer(freq).timeout
	position=cameraPos
